<template>
	<view class="bgMinor2 pt-24 plr-24 pt-40 pb-40" :style="{ minHeight: `${windowHeight}px`, height: 'auto' }">

  <view class="container" v-if='dataInfo.popupUseRef'>
        <view class="centered-div">
			<view class="relative ptb-40 mlr-40" id="release_warp">
						<view class="closeClass" @click="close_release">
							<uv-icon name="close-circle" color="#E1E1E1" size="28" @click="dataInfo.popupUseRef = false"></uv-icon>
						</view>
						<view class="mt-40">
							<view class="bgWhite">
								<view class="">
									<view class="Flex">
										<img :src=" dataInfo.imgUrl" style="min-width:30vw !important;height:400rpx !important;"
											mode="aspectFit"></img>
										
								<!-- 	<image
										:key="timer"
										class="release_img"
										:style="{ width: imageStyle.width, height: imageStyle.height }"
										:src="dataInfo.imgUrl"
										lazy-load
									/>			
								 -->
									</view>
									<view class="Flex pt-40 pb-24">
										<view class="">
											<uv-avatar v-if="dataInfo.avatar" :src="dataInfo.avatar" shape="circle"
											size="60rpx"></uv-avatar>
											<uv-avatar v-else src="https://via.placeholder.com/200x200.png/2878ff" shape="circle"
												size="60rpx"></uv-avatar>
										</view>
										<view class="ml-20 size-34 bold">{{ dataInfo.realname }}</view>
										<view class="ml-24">
											<uv-image v-if="dataInfo.isMember == 1" src="/static/images/vip2.png" width="44rpx" height="44rpx"
												mode="scaleToFill"></uv-image>
											<uv-image v-else src="/static/images/vip1.png" width="44rpx" height="44rpx"
												mode="scaleToFill"></uv-image>
										</view>
									</view>
									<!-- class="uni-input" -->
									 <!--  -->
									<view class="" id="copyright_amount">
										<input
											class="uni-input"
											v-model="dataInfo.price" 
											:maxlength="10"
											type="number"
											style="width: 289rpx;text-align: center;"
											placeholder="请填写该图版权金额"
										/>
										<!-- <view v-else-if="dataInfo.price == null" style='position: absolute;color:#9E9E9E;' class="" @click='dataInfo.price =""'>请填写该图版权金额</view> -->
									</view>
									
									<view id="info">
										<view>填写后一经发布无法再次修改</view>
										<view>修改需删除此图后重新上传</view>
									</view>
									<view class="agreement-container">
										<image
											class="check-icon"
											:src="dataInfo.isSelected ? '/static/images/selected.jpg' : '/static/images/notselected.jpg'"
											@click="toggleSelection"
										></image>
									<view @click="addOpen('/pages/mine/privacy?name=7')">
											<text class="agreement-text" >用户协议：点击查看<text >《用户图像版权协议》</text></text>
									</view>	
								
									</view>
								</view>
								<view class="mt-30 Flex" >
									<view
									style='border-radius: 20rpx;'
		                            	class="release_btn"
										:class="{ 'disabled-btn': !dataInfo.isSelected }"
										@click="confirmRelease"
									>
										确认发布
									</view>
								</view>
							</view>
						</view>
					</view>	
		</view>
    </view>
		<!-- 我的页面 进入 -->
		<z-paging ref="refPaging" v-if="dataInfo.flag === 'veinMan1' || dataInfo.flag === 'veinMan2'">
  
			<view class="" style="margin: 30rpx 30rpx;border-radius: 16rpx 16rpx 0rpx 0rpx;box-sizing: border-box;
		box-shadow: 0 0 8px #cecece;">
				<view class="bgMinor5 radius-16" style="width: 100%;height: 800rpx;">

					<view class="Flex " style="width: 394x;height: 800rpx;">

						<img :src=" dataInfo.imgUrl" style="width:100% !important;height:800rpx !important;"
							mode="aspectFit"></img>

					</view>

					<view class="bgWhite plr-24 pb-40"
						style="min-height: 200rpx; border-radius:0rpx 0rpx 16rpx 16rpx; box-shadow: 0px 0px 0px 0px #cecece;">
						<view class="flex1 ptb-24 border-b-2">
							<view class="">

								<uv-avatar :src="dataInfo.avatar" shape="circle" size="100rpx"></uv-avatar>
							</view>
							<view class="ml-20 flex-1">
								<view class="flex">
									<view class="flex1">
										<view class="size-34 bold">{{dataInfo.realname}}</view>
										<view class="ml-24" style="visibility: hidden !important">
											<uv-image src="/static/images/vip2.png" width="44rpx" height="44rpx"
												mode="scaleToFill"></uv-image>
											<!-- <uv-image src="/static/images/vip1.png" width="44rpx" height="44rpx" mode="scaleToFill"></uv-image> -->
										</view>
									</view>
									<!-- <view class="flex flex-bottom lineHeight1">
									<view class="size-20">￥</view>
									<view class="numClass">30</view>
								</view> -->
								</view>
								<view class="flex mt-18">
									<view class="flex1">
										<view class="flex1">
											<!-- "isCollect":"0:未收藏 1：已收藏", -->
											<!-- <uv-image src="/static/images/xihuan.png" width="30rpx" height="30rpx" mode="scaleToFill"></uv-image> -->
											<uv-image @click="kongAiFun(1)" v-if="!dataInfo.kongAi  "
												src="/static/images/xin.png" width="40rpx" height="40rpx" style='position: relative !important;top: -20px !important;'
												mode="scaleToFill"></uv-image>
											<uv-image @click="kongAiFun(1)" v-else src="/static/images/Hai.png"
												width="30rpx" height="30rpx" mode="scaleToFill"></uv-image>
											<view class="ml-10 color-black2 size-19">{{ dataInfo.dzNum  }}</view>
										</view>
										<view class="flex1 ml-40">
											<!-- <uv-image src="/static/images/shoucang.png" width="30rpx" height="30rpx" mode="scaleToFill"></uv-image> -->
											<uv-image @click="kongAiFun(0)" v-if="!dataInfo.shouAi"
												src="/static/images/wk.png" width="30rpx" height="30rpx"
												mode="scaleToFill"></uv-image>
											<uv-image @click="kongAiFun(0)" v-else src="/static/images/ws.png"
												width="30rpx" height="30rpx" mode="scaleToFill"></uv-image>
											<view class="ml-10 color-black2 size-19">{{ dataInfo.scNum  }}</view>
										</view>
									</view>
									<view @click="delFun" style="20rpx">
										<uv-image src="/static/images/delete.png" width="100rpx" height="46rpx"
											mode="scaleToFill"></uv-image>
									</view>
									<view v-if="dataInfo.flag === 'hot1'" class="btnUseClass"
										@click="addOpen(`/pages/homepage/customization?id=` + dataInfo.id )">使用同款</view>
									<view v-else-if="dataInfo.flag === 'hot2'"
										@click="addOpen(`/pages/homepage/customization?id=` + dataInfo.id )"
										class="btnUseClass btnUseClass2">使用同款</view>
								</view>
							</view>
						</view>

						<!-- <view class="ptb-24 flex1 size-24 color-black2">
						<view class="">
							关键词：
						</view>
						<view class="flex-1">
							七分身、时尚摄影、极简主义
						</view>
					</view> -->
						<view class="pt-20 pb-30 flex1 size-24 color-black2" style="min-height: 250rpx;">
							<view class="">用户需知：</view>
							<view class="flex-1">
								发布模型到“广场-脉星人”板块，可供商家选择；商家使用该模型并下载所生成的图片，按每张计费，供商家商用，同时给您创造收益。（均为正规商家）
							</view>

						</view>



					</view>
				</view>
			</view>
			<template #bottom>

				<view class="pd-24 bgMinor2" style="margin-bottom: 50rpx;">
					<view class="list_b_btn" v-if=" dataInfo.state  == 0" @click="isFaBuFun(0)">发 布</view>
					<view class="list_b_btn list_b_btn2" v-else @click="isFaBuFun('1')">取消发布</view>
				</view>
				<!-- <view class="mt-30"  > -->
				<!-- "state":0 # 0:末发布 1:已发布， -->
				<!-- </view> -->
			</template>
		</z-paging>
		<!-- class="shadowClass" -->
		<!-- 广场 进入 热门 -->
		<view v-else-if="dataInfo.flag === 'hot1' ||dataInfo.flag === 'hot3' || dataInfo.flag === 'hot2'" style="border-radius: 16rpx;box-sizing: border-box;
		box-shadow: 0 0 8px #cecece;">



			<view class="bgMinor5 radius-16">

				<view class="Flex " style="width: 394x;height: 800rpx;">
					<!-- 在模型生成好时，界面换成“发布”详情界面 -->

					<!-- <view class="size-30 color-black3 ml-10">请耐心等候</view> -->
					<!-- <uv-image :src="dataInfo.imgUrl" height="800rpx" mode="heightFix"></uv-image> -->

					<img :src=" dataInfo.imgUrl" style="width:100% !important;height:800rpx !important;"
						mode="aspectFit"></img>


				</view>
				<view class="bgWhite plr-24 pb-40">
					<view class="flex1 ptb-24 border-b-2">
						<view class="">

							<uv-avatar :src="dataInfo.avatar" shape="circle" size="100rpx"></uv-avatar>

						</view>
						<view>
							<view class="ml-20 flex-1">
								<view class="flex" style="display: flex;width: 500rpx;justify-content: space-between;">
									<view class="flex1"  >
										<view class="size-34 bold">{{dataInfo.realname}}</view>
										<view class="ml-24"  v-show="dataInfo.flag === 'hot3'" >
											
											<uv-image @click="addOpen(`/pages/homepage/rehandling`)"
											v-if='dataInfo.isMember != 1'
												src="/static/images/vip1.png" width="44rpx" height="44rpx"
												mode="scaleToFill"></uv-image>
											<uv-image @click="addOpen('/pages/homepage/rehandling')"
											v-else
												src="/static/images/vip2.png" width="44rpx" height="44rpx"
												mode="scaleToFill"></uv-image>
										</view>

										<!-- <uv-image src="/static/images/vip1.png" width="44rpx" height="44rpx" mode="scaleToFill"></uv-image> -->
									</view>
									<view v-if="dataInfo.flag === 'hot3'"  style="display: flex;justify-content: center;align-items: flex-end;">
										<view v-if="dataInfo.flag === 'hot3'"  style="font-size: 25rpx;margin-bottom: 4rpx;">¥</view>  
										<view v-if="dataInfo.flag === 'hot3'" class="gradient-text">{{dataInfo.price}} </view>
									</view>
									
								</view>
								<!-- <view class="flex flex-bottom lineHeight1">									<view class="size-20">￥</view>
									<view class="numClass">30</view>
								</view> -->

							</view>

							<view class="flex mt-18 ml-20">
								<view class="flex1">
									<view class="flex1">
										<!-- <uv-image src="/static/images/xihuan.png" width="30rpx" height="30rpx" mode="scaleToFill"></uv-image> -->
										<!-- 	<uv-image @click="kongAiFun(1)" v-if="dataInfo.kongAi"
											src="/static/images/kongAi.png" width="30rpx" height="30rpx"
											mode="scaleToFill"></uv-image>
										<uv-image @click="kongAiFun(1)" v-else src="/static/images/Hai.png"
											width="30rpx" height="30rpx" mode="scaleToFill"></uv-image> -->
											 
										<view  v-if=" !dataInfo.isLike  || !dataInfo.kongAi">
											<uv-image @click="kongAiFun(1)" 
												src="/static/images/kong.png" width="30rpx" height="30rpx" 
												mode="scaleToFill"></uv-image>
										</view>
										<uv-image @click="kongAiFun(1)" v-else src="/static/images/Hai.png"
											width="30rpx" height="30rpx" mode="scaleToFill"></uv-image>
										<view class="ml-10 color-black2 size-22">{{ dataInfo.dzNum  }}</view>
									</view>
									<view class="flex1 ml-40">
										<!-- <uv-image src="/static/images/shoucang.png" width="30rpx" height="30rpx" mode="scaleToFill"></uv-image> -->
										<uv-image @click="kongAiFun(0)" v-if=" !dataInfo.isCollect  ||!dataInfo.shouAi"
											src="/static/images/wk.png" width="30rpx" height="30rpx"
											mode="scaleToFill"></uv-image>
										<uv-image @click="kongAiFun(0)" v-else src="/static/images/ws.png" width="30rpx"
											height="30rpx" mode="scaleToFill"></uv-image>
										<view class="ml-10 color-black2 size-22">{{ dataInfo.scNum  }}</view>
									</view>
								</view>
                                 
				<!-- 				<view v-if="dataInfo.flag === 'hot1'" class="btnUseClass"
									@click="addOpen(`/pages/homepage/customization?id=` + dataInfo.id )">
									{{'使用同款'}}</view> -->
									<view v-if="dataInfo.flag === 'hot1'" >
										<uv-image @click="addOpen(`/pages/homepage/customization?id=` + dataInfo.id )" src="/static/images/shiyongtongkuan1.png"
											width="98rpx" height="32rpx" mode="scaleToFill"></uv-image>
									</view>
							
									
							<!-- 	<view v-if="dataInfo.flag === 'hot3'" class="btnUseClass"
									@click="addOpen(`/pages/homepage/rehandling?tab=1&current=1&id=` + dataInfo.id )">
									{{dataInfo.flag === 'hot3'? '免费试用':'使用同款'}}</view> -->
									<!-- @click="addOpen(`/pages/homepage/rehandling?tab=1&current=1&id=` + dataInfo.id )" -->
								<view v-if="dataInfo.flag === 'hot3'" @click="Trial">
									<uv-image  src="/static/images/shiyong1.png" width="60rpx"
										height="30rpx" mode="scaleToFill"></uv-image>
									
								</view>			
								<view v-else-if="dataInfo.flag === 'hot2'"
									@click="addOpen(`/pages/homepage/customization?id=` + dataInfo.id )"
									class="btnUseClass btnUseClass2"> {{'使用同款'}}</view>
							</view>
						</view>
					</view>
					<view class="ptb-24 flex1 size-24 color-black2" style="color: rgb(128,128,128);min-height:270rpx ;">
						<view class="">
							关键词： 
						</view>
						<view class="flex-1">
							{{dataInfo.characters}}
						</view>
					</view>
				</view>
			</view>
		</view>

		<!-- class="shadowClass" -->
		<!-- 广场 进入 脉星人 -->
		<view v-else-if="dataInfo.flag === 'tryOut1' || dataInfo.flag === 'tryOut2'" style="margin: 30rpx 30rpx;border-radius: 16rpx;box-sizing: border-box;
		box-shadow: 0 0 8px #cecece;">

			<view class="bgMinor5 radius-16">

				<view class="Flex " style="width: 394x;height: 800rpx;">
					<!-- 在模型生成好时，界面换成“发布”详情界面 -->

					<!-- <view class="size-30 color-black3 ml-10">请耐心等候</view> -->
					<!-- <uv-image :src="dataInfo.imgUrl" height="800rpx" mode="heightFix"></uv-image> -->

					<img :src=" dataInfo.imgUrl" style="width:100% !important;height:800rpx !important;"
						mode="aspectFit"></img>

				</view>
				<view class="bgWhite plr-24 pb-40">
					<view class="flex1 ptb-24 border-b-2">
						<view class="">
							<uv-avatar :src="dataInfo.avatar" shape="circle" size="100rpx"></uv-avatar>
						</view>
						<view class="ml-20 flex-1">
							<view class="flex">
								<view class="flex1">
									<view class="size-34 bold">{{dataInfo.realname}}</view>
									
									<view class="ml-24">
										<uv-image src="/static/images/vip2.png" width="44rpx" height="44rpx"
											style="visibility: hidden;" mode="scaleToFill"></uv-image>
										<!-- <uv-image src="/static/images/vip1.png" width="44rpx" height="44rpx" mode="scaleToFill"></uv-image> -->
									</view>
								</view>
								<view class="flex flex-bottom lineHeight1">
									<view class="size-20">￥</view>
									<view class="numClass">30</view>
								</view>
							</view>
							<view class="flex mt-18">
								<view class="flex1">
									<!-- <uv-image src="/static/images/xihuan.png" width="30rpx" height="30rpx" mode="scaleToFill"></uv-image> -->
									<uv-image @click="kongAiFun(1)" v-if=" dataInfo.kongAi"
										src="/static/images/xin.png" width="40rpx" height="40rpx" style='position: relative !important;top: -20px !important;'
										mode="scaleToFill"></uv-image>
									<uv-image @click="kongAiFun(1)" v-else src="/static/images/Hai.png" width="30rpx"
										height="30rpx" mode="scaleToFill"></uv-image>
									<view class="ml-10 color-black2 size-19">{{ dataInfo.dzNum  }}</view>
								</view>
								<view class="flex1 ml-40">
									
									<!-- <uv-image src="/static/images/shoucang.png" width="30rpx" height="30rpx" mode="scaleToFill"></uv-image> -->
									<uv-image @click="kongAiFun(0)" v-if=" dataInfo.shouAi" src="/static/images/wk.png"
										width="30rpx" height="30rpx" mode="scaleToFill"></uv-image>
									<uv-image @click="kongAiFun(0)" v-else src="/static/images/ws.png" width="30rpx"
										height="30rpx" mode="scaleToFill"></uv-image>
									<view class="ml-10 color-black2 size-19">{{ dataInfo.scNum  }}</view>
								</view>
								
								<view v-if="dataInfo.flag === 'tryOut1'" class="btnUseClass">免费试用</view>
								<view v-else-if="dataInfo.flag === 'tryOut2'" class="btnUseClass btnUseClass2">免费试用
								</view>
							</view>
						</view>
					</view>
					<view class="ptb-24 flex1 size-24 color-black2" style="color: rgb(128,128,128);min-height: 270rpx;">
						<view class="">
							关键词：  
						</view>
						<view class="flex-1">
							{{dataInfo.characters}}
						</view>
					</view>
				</view>
			</view>
		</view>


		<!-- 	<view v-else>

			<view class="shadowClass">
				<view class="bgMinor5 radius-16">
					<view class="Flex height-800">
						<view class="size-30 color-black3 ml-10">请耐心等候</view>
					</view>
					<view class="bgWhite plr-24">
						<view class="Flex ptb-24 border-b-2">
							<view class="">
								<uv-avatar src="https://via.placeholder.com/200x200.png/2878ff" shape="circle"
									size="100rpx"></uv-avatar>
							</view>
							<view class="ml-20 size-34 bold">{{dataInfo.realname}}</view>
							<view class="ml-24">
								<uv-image src="/static/images/vip2.png" width="44rpx" height="44rpx"
									style="visibility: hidden;" mode="scaleToFill"></uv-image>
								<uv-image src="/static/images/vip1.png" width="44rpx" height="44rpx" mode="scaleToFill"></uv-image>
							</view>
						</view>
						<view class="ptb-24 flex1 size-24 color-black2">
							<view class="">用户需知：</view>
							<view class="flex-1">
								发布模型到“广场-脉星人”板块，可供商家选择；商家使用该模型并下载所生成的图片，按每张计费，供商家商用，同时给您创造收益。（均为正规商家）
							</view>

						</view>

					</view>
				</view>
			</view>
			<view class="">
				<view class="width100 height-90"></view>
				<view class="fixedClass plr-24">
					<view class="list_b_btn">正在生成中…</view>
				</view>
			</view>
		</view> -->
		
		<uv-popup ref="popupUseRef" mode="center" style="z-index: 9999;" round="16rpx">
			<view class="relative ptb-40 mlr-40" id="release_warp">
				<view class="closeClass" @click="close_release">
					<uv-icon name="close-circle" color="#E1E1E1" size="28"></uv-icon>
				</view>
				<view class="mt-40">
					<view class="bgWhite">
						<view class="">
							<view class="Flex">
							<image
								:key="timer"
								class="release_img"
								:style="{ width: imageStyle.width, height: imageStyle.height }"
								:src="dataInfo.imgUrl"
								lazy-load
							/>			
						
							</view>
							<view class="Flex pt-40 pb-24">
								<view class="">
									<uv-avatar v-if="dataInfo.avatar" :src="dataInfo.avatar" shape="circle"
									size="60rpx"></uv-avatar>
									<uv-avatar v-else src="https://via.placeholder.com/200x200.png/2878ff" shape="circle"
										size="60rpx"></uv-avatar>
								</view>
								<view class="ml-20 size-34 bold">{{ dataInfo.realname }}</view>
								<view class="ml-24">
									<uv-image v-if="dataInfo.isMember == 1" src="/static/images/vip2.png" width="44rpx" height="44rpx"
										mode="scaleToFill"></uv-image>
									<uv-image v-else src="/static/images/vip1.png" width="44rpx" height="44rpx"
										mode="scaleToFill"></uv-image>
								</view>
							</view>
							<!-- class="uni-input" -->
							 <!--  -->
							<view class="" id="copyright_amount">
								<input
									class="uni-input"
									v-model="dataInfo.price" 
									:maxlength="10"
									type="number"
									  v-if="dataInfo.price != null"
								/>
								<view v-else-if="dataInfo.price == null" style='position: absolute;color:#9E9E9E;' class="" @click='dataInfo.price =""'>请填写该图版权金额</view>
							</view>
							
							<view id="info">
								<view>填写后一经发布无法再次修改</view>
								<view>修改需删除此图后重新上传</view>
							</view>
							<view class="agreement-container">
								<image
									class="check-icon"
									:src="dataInfo.isSelected ? '/static/images/selected.jpg' : '/static/images/notselected.jpg'"
									@click="toggleSelection"
								></image>
							<view @click="addOpen('/pages/mine/privacy?name=7')">
									<text class="agreement-text" >用户协议：点击查看<text >《用户图像版权协议》</text></text>
							</view>	
						
							</view>
						</view>
						<view class="mt-30 Flex" >
							<view
							style='border-radius: 20rpx;'
                            	class="release_btn"
								:class="{ 'disabled-btn': !dataInfo.isSelected }"
								@click="confirmRelease"
							>
								确认发布
							</view>
						</view>
					</view>
				</view>
			</view>
		</uv-popup>
		<uv-popup ref="popupUseRefsj" mode="center" :close-on-click-overlay="false" round="16rpx" safeAreaInsetTop style='width: 660rpx !important;left: 50rpx !important;position: relative !important;'
			closeable>
			<view class="pb-20" style='width: 655rpx !important;'>
				<view class="mxr">
					脉星人功能仅商家可以使用
				</view>
				<view class="cwsj" @click="cwsj">
					成为商家
				</view>
			</view>
		</uv-popup>
	</view>
</template>

<script setup lang="ts">
	import { baseURL } from '@/utils/config.ts';
	import { reactive,ref ,onMounted} from 'vue';
	import { get, post, del } from '@/utils/request';
	import { getWindowHeight } from '@/pages/util/getHeight';
	import { onLoad, onUnload } from '@dcloudio/uni-app';
	import { addOpen, loggedIn, addOpenTab, formatNumber } from '@/pages/util/hooks';
	import useLoginStore from '@/pinia-store/userInfoStore';
	const useLogin = useLoginStore();
	const windowHeight = getWindowHeight();
		const popupUseRefsj = ref(null);
	// console.log('useLoginuseLogin',useLogin);
	/** @name 数据 */
	const dataInfo = reactive({
		ishow: 'b',
		// hot1：热门  tryOut1：脉星人	 	发布脉星人：veinMan1
		flag: '',
		popupUseRef:false,
		captcha: '',
		isCollect: false,
		imgUrl: '',
		isUseMoney: false,
		scNum: 0,
		dzNum: 0,
		kongAi: true,
		price:null,
		id: "",
		state: 0,
		fabu: true,
		shouAi: true,
		avatar: null,
		isFaBu: false,
		isLike: false,
		realname: '',
		isshouw: true,
		isSelected: false, // 是否选中协议
	});
	const popupUseRef = ref(null);
	onUnload(() => {
		 
		const pages = getCurrentPages(); // 获取当前页面栈的实例
		const currentPage = pages[pages.length - 1]; // 获取当前页面实例
		const route = currentPage.route; // 获取当前页面的路由
		console.log('当前页面路由:', route);
		uni.setStorageSync('route', route);

	})
	const handleMouseDown = () => {
		dataInfo.isUseMoney = true;
	};
	const handleMouseUp = () => {
		dataInfo.isUseMoney = false;
	};
	const particularsFun = async (val) => {

		console.log(val)
		let id = String(val.id ? val.id : val)
		try {
			const response = await get<{
				result : any;
				id : String;
			}>('customized/getDetailsData', { id: id });
			if (response) {
				// 
				dataInfo.avatar = response.result.avatar
				dataInfo.imgUrl = response.result.synthesisImg ? response.result.synthesisImg : response.result.imgUrl
				dataInfo.dzNum = response.result.dzNum
				dataInfo.scNum = response.result.scNum
				dataInfo.id = response.result.id
				dataInfo.realname = response.result.realname
				dataInfo.state = response.result.state
				dataInfo.isFaBu = true
dataInfo.isMember = response.result.isMember
                 dataInfo.price =response.result.price
				dataInfo.characters = response.result.characters
				dataInfo.isCollect = response.result.isCollect == 1 ? true : false
				dataInfo.isLike = response.result.isLike == 1 ? true : false


				dataInfo.shouAi = dataInfo.isCollect
				dataInfo.kongAi = dataInfo.isLike

				if (dataInfo.imgUrl) {
					adjustImageSize(dataInfo.imgUrl);
				}
				// .substring(0, 30) +'...'
			}

		} catch (error) {
			console.error(error);
		}
	};
	const delFun = async (val) => {
		console.log(val)
		try {
			const response = await del<{
				ids : String;
			}>('replacement/deleteBatch?ids=' + dataInfo.id,);
			if (response) {
				if (dataInfo.isshouw == true) {

					dataInfo.isshouw = false
					uni.$emit('refreshData', { refresh: true });
					uni.showToast({
						title: '删除成功',
						icon: 'error',
						duration: 2000
					});
					setTimeout(() => {
						uni.navigateBack({
							delta: 1
						})
					}, 800)

				}


				//  uni.navigateBack({
				//    delta: 1,
				// success() {
				//         uni.$emit('update',{msg:'页面更新'})
				//     }
				//  });
				// dataInfo.imgUrl = response.result.synthesisImg ? response.result.synthesisImg : response.result.imgUrl
				// dataInfo.dzNum = response.result.dzNum
				// dataInfo.scNum = response.result.scNum
				// dataInfo.id = response.result.id
				// dataInfo.realname = response.result.realname


			}

		} catch (error) {
			console.error(error);
		}
	};
	const kongAiFun = async (val) => {
		// (0:收藏 1:喜欢 2:下载)"
		if (val == 0) {
			dataInfo.shouAi = !dataInfo.shouAi
		} else if (val == 1) {
			dataInfo.kongAi = !dataInfo.kongAi
		}

		console.log(val)
		try {
			const response = await post<{
				id : Number;
				type : String
			}>('collect/add', { imgId: dataInfo.id, type: val });
			if (response) {
				particularsFun({ id: dataInfo.id })
			}

		} catch (error) {
			console.error(error);
		}
	};
	const isFaBuFun = async (id) => {
		if(id == '0'){
			// if (dataInfo.imgUrl) {
				adjustImageSize(dataInfo.imgUrl);
			// }
			dataInfo.popupUseRef = true
			// popupUseRef.value?.open();
			console.log(dataInfo.imgUrl)
		}else{
			try {
			const response = await post<{
				id : Number;
			}>('/replacement/release', { id: dataInfo.id });
			if (response) {
				particularsFun({ id: dataInfo.id })
			}
			} catch (error) {
				console.error(error);
			}
		}
		return
		dataInfo.isFaBu = !dataInfo.isFaBu
		try {
			const response = await post<{
				id : Number;
			}>('/replacement/release', { id: dataInfo.id });
			if (response) {
				particularsFun({ id: dataInfo.id })
				// dataInfo.imgUrl = response.result.imgUrl
				// dataInfo.dzNum = response.result.dzNum
				// dataInfo.scNum = response.result.scNum
				// dataInfo.id = response.result.id

			}

		} catch (error) {
			console.error(error);
		}
	};
    // 切换选中状态
    const toggleSelection = () => {
        dataInfo.isSelected = !dataInfo.isSelected;
    };
	
	const Trial = ()=>{
				var isMerchant = JSON.parse(uni.getStorageSync('userData')).isMerchant;
		if(isMerchant == 1){
			uni.switchTab({
				url: `/pages/homepage/rehandling?tab=1&current=1&id=` + dataInfo.id , // 目标页面路径（需在pages.json注册）
				success: () => console.log('跳转成功'),
				fail: (err) => console.error('跳转失败', err)
			})
		}else{
			popupUseRefsj.value?.open();
		}
	};
	const cwsj =  async () => {
		try {
			popupUseRefsj.value?.close();
			uni.navigateTo({
			               url: `/pages/subscribeMember/index`, // 目标页面路径（需在pages.json注册）
			               success: () => console.log('跳转成功'),
			               fail: (err) => console.error('跳转失败', err)
			           })
			// console.log("成为商家")
	
		} catch (error) {
			console.error(error);
		}
	}
    // 确认发布
	const confirmRelease = async (event) => {
		event.preventDefault();
		if (!dataInfo.isSelected) {
			uni.showToast({
				title: '请先同意用户协议',
				icon: 'none',
			});
			return;
		}
		if (!dataInfo.price) {
			uni.showToast({
				title: '请填写版权金额',
				icon: 'none',
			});
			return;
		}
		try {
			const response = await post<{
				id: Number;
			}>('/maixing/release', { 
				id: dataInfo.id,
				price: String(dataInfo.price) // 添加 price 参数
			});

			if (response) {
				particularsFun({ id: dataInfo.id });
				close_release()
			}
		} catch (error) {
			console.error(error);
		}
	};

    // 关闭弹窗
    const close_release = () => {
        // popupUseRef.value?.close();
		dataInfo.popupUseRef = false
    };

	const imageStyle = reactive({
		width: 'auto',
		height: 'auto',
	});
	let timer = ref(0);
	const adjustImageSize = async (imgUrl) => {
    try {
		console.log('0000000000000000000000000000000000000')
        const res = await uni.getImageInfo({
            src: imgUrl,
        });
   console.log('00000000000000000000000000000000000001111')
        const maxHeight = 300; // 最大高度
        const ratio = res.width / res.height; // 宽高比

        console.log('图片实际宽高:', res.width, res.height);

        if (res.height > maxHeight) {
            // 如果高度超过最大值，按比例缩放
            imageStyle.height = `${maxHeight}rpx`;
            imageStyle.width = `${maxHeight * ratio}rpx`;
        } else {
            // 如果高度未超过最大值，使用原始宽高
            imageStyle.height = `${res.height}rpx`;
            imageStyle.width = `${res.width}rpx`;
        }

        timer.value++;
    } catch (error) {
        console.error('获取图片信息失败:', error);
    }
};
	onLoad((options : any) => {
		
		if (options?.user) {
			particularsFun(options.user)
		}

		if (options?.flag) {
			dataInfo.flag = options.flag
		}
		console.log(dataInfo,'dataInfo')
	});
	/** @name xxx */
	function getUserInfo() { }
</script>

<style scoped lang="scss">
	// :deep(.checklist-box) {
	// 	//  模版
	// }
	.UseMoney {
		color: #ffffff;
	}

	.btnUseClass {
		padding: 8rpx 10rpx;
		font-size: 24rpx;
		color: $ai-fonts;
		line-height: 1;
		border: 1px solid $ai-fonts;
		border-radius: 8rpx;
	}

	.btnUseClass2 {
		color: white;
		border: 1px solid $ai-primary;
		background-color: $ai-primary;
	}

	// 按钮
	.list_b_btn2 {
		background: #b6b6b6;
	}

	.numClass {
		font-size: 42rpx;
		font-weight: 700;
		background: -webkit-linear-gradient(#ffc800, #ff0053); // , 100%,#ff5037 left top,
		-webkit-background-clip: text;
		-webkit-text-fill-color: transparent;
	}
	#release_warp{
		width: 90%;
		padding: 20px auto;
		box-sizing: border-box;
		position: relative;
		.release_img{
			object-fit: contain; 
			border-radius: 10rpx;
			height: 400rpx;
		}
		.closeClass {
			position: absolute;
			right:-20rpx;
			top: 24rpx;
		}
	
		#info {
			font-size: 22rpx;
			color: #999999;
			text-align: center;
			margin-top: 20rpx;
			box-sizing: border-box;
			margin-bottom: 20rpx;
		}
	
		.agreement-container {
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 24rpx;
			color: #999;
		}

		.check-icon {
			width: 27rpx;
			height: 27rpx;
			margin-right: 5px;
		}

		.agreement-text {
			font-size: 20rpx;
			text{
				color: #007aff;
			}
		}
		.release_btn {
			width: 100%;
			background: #007aff;
			color: #ffffff;
			text-align: center;
			padding: 20rpx 0;
			margin-top: 40rpx;
			border-radius: 8rpx;
			cursor: pointer;
		}

		/* 禁用状态按钮样式 */
		.disabled-btn {
			color: #9E9E9E;
			background: #F5F5F5;
			cursor: not-allowed;
		}
	}	.mxr {
		width: 690rpx;
		box-sizing: border-box;
		padding: 0rpx 50rpx;
		box-sizing: border-box;
		font-weight: bold;
	}
	
	.cwsj {
		width: 300rpx;
		height: 60rpx;
		margin: 50rpx auto 0rpx;
		border-radius: 10rpx;
		line-height: 60rpx;
		text-align: center;
		color: #ffffff;
		background: linear-gradient(90deg, rgb(255, 165, 13), rgb(255, 1, 82));
	}
	
	
	#copyright_amount{
		  width: 400rpx;
		  height: 90rpx; /* 增加高度 */
		  line-height: 50rpx; /* 行高与高度一致 */
		  margin: 30rpx auto;
		  background: #F5F5F5;
		  border-radius: 20rpx;
		  box-sizing: border-box;
		  display: flex; /* 添加flex布局 */
		  align-items: center; /* 垂直居中 */
		  justify-content: center; /* 水平居中 */
	}
	
	
	:deep(.uv-input) {
	  /* 固定输入框高度，确保占位文本和输入内容时高度一致 */
	  height: 80rpx !important;
	  line-height: 80rpx !important;
	  padding: 0 20rpx !important;
	  box-sizing: border-box !important;
	  /* 去除可能的默认动画 */
	  transition: none !important;
	  /* 确保圆角和边框样式一致 */
	  border-radius: 20rpx !important;
	  border: 1rpx solid #eee !important;
	    will-change: transform; /* 提升性能，减少重排 */
	    transition: none !important; /* 移除默认动画 */
	}
	
	/* 优化占位文本样式，避免高度差异 */
	:deep(.uv-input__placeholder) {
	  line-height: 80rpx !important;
	  height: 80rpx !important;
	  margin: 0 !important;
	  padding: 0 !important;
	  /* 确保占位文本的对齐方式和颜色一致 */
	  text-align: left !important;
	  color: #999 !important;
	}
	
	/* 确保输入框容器高度固定 */
	:deep(.uv-input__content) {
	  height: 80rpx !important;
	  line-height: 80rpx !important;
	}
	
	/* 修复有边框模式下的布局问题 */
	:deep(.uv-input--border-surround) {
	  padding: 0 !important;
	}
	 .gradient-text {
	      font-size: 36rpx; /* 字体大小，可按需调整 */
	      font-weight: bold; /* 加粗字体，让渐变更明显 */
	      background: linear-gradient(to right, orange, red); /* 从橙色到红色的线性渐变，方向可调整 */
	      -webkit-background-clip: text; /* 将背景裁剪为文字形状，webkit 前缀适配 Safari、Chrome 等 */
	      background-clip: text; 
	      color: transparent; /* 让文字本身颜色透明，显示背景渐变 */
	    
		}
		.container {
		    display: flex;
		    justify-content: center;
		    align-items: center;
		    width: 100%;
		    height: 100vh;
		    background-color: #f0f0f0;
		}
		
		.centered-div {
		    padding: 10px;
			width: 95%;
			min-height: 400rpx;
			margin-bottom: 160rpx;
		    background-color: #fff;
			z-index: 999;
		    border-radius: 8px;
		    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
		}
</style>